package com.google.android.gms.internal;

import android.content.Context;
import android.text.TextUtils;
import com.google.ads.mediation.admob.AdMobAdapter;
import com.google.android.gms.common.internal.Hide;
import java.util.Iterator;
import java.util.List;

@Hide
@zzabh
public final class zzzs extends zzzi {
    private final zzov zzanh;
    private zzwf zzanu;
    /* access modifiers changed from: private */
    public final zzaof zzcct;
    private zzvq zzcir;
    private zzvo zzcon;
    protected zzvw zzcoo;
    /* access modifiers changed from: private */
    public boolean zzcop;

    zzzs(Context context, zzahe zzahe, zzwf zzwf, zzzn zzzn, zzov zzov, zzaof zzaof) {
        super(context, zzahe, zzzn);
        this.zzanu = zzwf;
        this.zzcir = zzahe.zzdcj;
        this.zzanh = zzov;
        this.zzcct = zzaof;
    }

    private static String zzk(List<zzvw> list) {
        String str = "";
        if (list == null) {
            return str.toString();
        }
        Iterator<zzvw> it = list.iterator();
        while (true) {
            int i = 0;
            if (!it.hasNext()) {
                return str.substring(0, Math.max(0, str.length() - 1));
            }
            zzvw next = it.next();
            if (!(next == null || next.zzcje == null || TextUtils.isEmpty(next.zzcje.zzche))) {
                String valueOf = String.valueOf(str);
                String str2 = next.zzcje.zzche;
                switch (next.zzcjd) {
                    case -1:
                        i = 4;
                        break;
                    case 0:
                        break;
                    case 1:
                        i = 1;
                        break;
                    case 3:
                        i = 2;
                        break;
                    case 4:
                        i = 3;
                        break;
                    case 5:
                        i = 5;
                        break;
                    default:
                        i = 6;
                        break;
                }
                long j = next.zzcjj;
                StringBuilder sb = new StringBuilder(33 + String.valueOf(str2).length());
                sb.append(str2);
                sb.append(".");
                sb.append(i);
                sb.append(".");
                sb.append(j);
                String sb2 = sb.toString();
                StringBuilder sb3 = new StringBuilder(1 + String.valueOf(valueOf).length() + String.valueOf(sb2).length());
                sb3.append(valueOf);
                sb3.append(sb2);
                sb3.append("_");
                str = sb3.toString();
            }
        }
    }

    public final void onStop() {
        synchronized (this.zzcoe) {
            super.onStop();
            if (this.zzcon != null) {
                this.zzcon.cancel();
            }
        }
    }

    /* JADX INFO: finally extract failed */
    /* JADX WARNING: type inference failed for: r3v3, types: [com.google.android.gms.internal.zzvo] */
    /* JADX WARNING: type inference failed for: r18v2, types: [com.google.android.gms.internal.zzwc] */
    /* JADX WARNING: type inference failed for: r5v5, types: [com.google.android.gms.internal.zzvz] */
    /* access modifiers changed from: protected */
    /* JADX WARNING: Code restructure failed: missing block: B:11:0x00a3, code lost:
        r3 = r3.getBundle("com.google.ads.mediation.admob.AdMobAdapter");
     */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void zze(long r33) throws com.google.android.gms.internal.zzzl {
        /*
            r32 = this;
            r1 = r32
            java.lang.Object r2 = r1.zzcoe
            monitor-enter(r2)
            com.google.android.gms.internal.zzvq r3 = r1.zzcir     // Catch:{ all -> 0x0177 }
            int r3 = r3.zzcif     // Catch:{ all -> 0x0177 }
            r4 = -1
            if (r3 == r4) goto L_0x0043
            com.google.android.gms.internal.zzvz r3 = new com.google.android.gms.internal.zzvz     // Catch:{ all -> 0x0177 }
            android.content.Context r6 = r1.mContext     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzahe r4 = r1.zzcob     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzacf r7 = r4.zzcvm     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzwf r8 = r1.zzanu     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzvq r9 = r1.zzcir     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzacj r4 = r1.zzcoc     // Catch:{ all -> 0x0177 }
            boolean r10 = r4.zzbid     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzacj r4 = r1.zzcoc     // Catch:{ all -> 0x0177 }
            boolean r11 = r4.zzbif     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzacj r4 = r1.zzcoc     // Catch:{ all -> 0x0177 }
            java.lang.String r12 = r4.zzcuh     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzny<java.lang.Long> r4 = com.google.android.gms.internal.zzoi.zzbrg     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzog r5 = com.google.android.gms.internal.zzlc.zzio()     // Catch:{ all -> 0x0177 }
            java.lang.Object r4 = r5.zzd(r4)     // Catch:{ all -> 0x0177 }
            java.lang.Long r4 = (java.lang.Long) r4     // Catch:{ all -> 0x0177 }
            long r15 = r4.longValue()     // Catch:{ all -> 0x0177 }
            r17 = 2
            com.google.android.gms.internal.zzahe r4 = r1.zzcob     // Catch:{ all -> 0x0177 }
            boolean r4 = r4.zzdcv     // Catch:{ all -> 0x0177 }
            r5 = r3
            r13 = r33
            r18 = r4
            r5.<init>(r6, r7, r8, r9, r10, r11, r12, r13, r15, r17, r18)     // Catch:{ all -> 0x0177 }
            goto L_0x008a
        L_0x0043:
            com.google.android.gms.internal.zzwc r3 = new com.google.android.gms.internal.zzwc     // Catch:{ all -> 0x0177 }
            android.content.Context r4 = r1.mContext     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzahe r5 = r1.zzcob     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzacf r5 = r5.zzcvm     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzwf r6 = r1.zzanu     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzvq r7 = r1.zzcir     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzacj r8 = r1.zzcoc     // Catch:{ all -> 0x0177 }
            boolean r8 = r8.zzbid     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzacj r9 = r1.zzcoc     // Catch:{ all -> 0x0177 }
            boolean r9 = r9.zzbif     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzacj r10 = r1.zzcoc     // Catch:{ all -> 0x0177 }
            java.lang.String r10 = r10.zzcuh     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzny<java.lang.Long> r11 = com.google.android.gms.internal.zzoi.zzbrg     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzog r12 = com.google.android.gms.internal.zzlc.zzio()     // Catch:{ all -> 0x0177 }
            java.lang.Object r11 = r12.zzd(r11)     // Catch:{ all -> 0x0177 }
            java.lang.Long r11 = (java.lang.Long) r11     // Catch:{ all -> 0x0177 }
            long r28 = r11.longValue()     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzov r11 = r1.zzanh     // Catch:{ all -> 0x0177 }
            com.google.android.gms.internal.zzahe r12 = r1.zzcob     // Catch:{ all -> 0x0177 }
            boolean r12 = r12.zzdcv     // Catch:{ all -> 0x0177 }
            r18 = r3
            r19 = r4
            r20 = r5
            r21 = r6
            r22 = r7
            r23 = r8
            r24 = r9
            r25 = r10
            r26 = r33
            r30 = r11
            r31 = r12
            r18.<init>(r19, r20, r21, r22, r23, r24, r25, r26, r28, r30, r31)     // Catch:{ all -> 0x0177 }
        L_0x008a:
            r1.zzcon = r3     // Catch:{ all -> 0x0177 }
            monitor-exit(r2)     // Catch:{ all -> 0x0177 }
            java.util.ArrayList r2 = new java.util.ArrayList
            com.google.android.gms.internal.zzvq r3 = r1.zzcir
            java.util.List<com.google.android.gms.internal.zzvp> r3 = r3.zzchv
            r2.<init>(r3)
            com.google.android.gms.internal.zzahe r3 = r1.zzcob
            com.google.android.gms.internal.zzacf r3 = r3.zzcvm
            com.google.android.gms.internal.zzkk r3 = r3.zzcrv
            android.os.Bundle r3 = r3.zzbhf
            java.lang.String r4 = "com.google.ads.mediation.admob.AdMobAdapter"
            r5 = 0
            if (r3 == 0) goto L_0x00b0
            android.os.Bundle r3 = r3.getBundle(r4)
            if (r3 == 0) goto L_0x00b0
            java.lang.String r6 = "_skipMediation"
            boolean r3 = r3.getBoolean(r6)
            goto L_0x00b1
        L_0x00b0:
            r3 = r5
        L_0x00b1:
            if (r3 == 0) goto L_0x00cf
            java.util.ListIterator r3 = r2.listIterator()
        L_0x00b7:
            boolean r6 = r3.hasNext()
            if (r6 == 0) goto L_0x00cf
            java.lang.Object r6 = r3.next()
            com.google.android.gms.internal.zzvp r6 = (com.google.android.gms.internal.zzvp) r6
            java.util.List<java.lang.String> r6 = r6.zzchd
            boolean r6 = r6.contains(r4)
            if (r6 != 0) goto L_0x00b7
            r3.remove()
            goto L_0x00b7
        L_0x00cf:
            com.google.android.gms.internal.zzvo r3 = r1.zzcon
            com.google.android.gms.internal.zzvw r2 = r3.zzh(r2)
            r1.zzcoo = r2
            com.google.android.gms.internal.zzvw r2 = r1.zzcoo
            int r2 = r2.zzcjd
            switch(r2) {
                case 0: goto L_0x0104;
                case 1: goto L_0x00fb;
                default: goto L_0x00de;
            }
        L_0x00de:
            com.google.android.gms.internal.zzzl r2 = new com.google.android.gms.internal.zzzl
            com.google.android.gms.internal.zzvw r3 = r1.zzcoo
            int r3 = r3.zzcjd
            r4 = 40
            java.lang.StringBuilder r6 = new java.lang.StringBuilder
            r6.<init>(r4)
            java.lang.String r4 = "Unexpected mediation result: "
            r6.append(r4)
            r6.append(r3)
            java.lang.String r3 = r6.toString()
            r2.<init>(r3, r5)
            throw r2
        L_0x00fb:
            com.google.android.gms.internal.zzzl r2 = new com.google.android.gms.internal.zzzl
            java.lang.String r3 = "No fill from any mediation ad networks."
            r4 = 3
            r2.<init>(r3, r4)
            throw r2
        L_0x0104:
            com.google.android.gms.internal.zzvw r2 = r1.zzcoo
            com.google.android.gms.internal.zzvp r2 = r2.zzcje
            if (r2 == 0) goto L_0x0176
            com.google.android.gms.internal.zzvw r2 = r1.zzcoo
            com.google.android.gms.internal.zzvp r2 = r2.zzcje
            java.lang.String r2 = r2.zzcho
            if (r2 == 0) goto L_0x0176
            java.util.concurrent.CountDownLatch r2 = new java.util.concurrent.CountDownLatch
            r3 = 1
            r2.<init>(r3)
            android.os.Handler r3 = com.google.android.gms.internal.zzaij.zzdfn
            com.google.android.gms.internal.zzzt r4 = new com.google.android.gms.internal.zzzt
            r4.<init>(r1, r2)
            r3.post(r4)
            r3 = 10
            java.util.concurrent.TimeUnit r6 = java.util.concurrent.TimeUnit.SECONDS     // Catch:{ InterruptedException -> 0x014e }
            r2.await(r3, r6)     // Catch:{ InterruptedException -> 0x014e }
            java.lang.Object r2 = r1.zzcoe
            monitor-enter(r2)
            boolean r3 = r1.zzcop     // Catch:{ all -> 0x014a }
            if (r3 != 0) goto L_0x0138
            com.google.android.gms.internal.zzzl r3 = new com.google.android.gms.internal.zzzl     // Catch:{ all -> 0x014a }
            java.lang.String r4 = "View could not be prepared"
            r3.<init>(r4, r5)     // Catch:{ all -> 0x014a }
            throw r3     // Catch:{ all -> 0x014a }
        L_0x0138:
            com.google.android.gms.internal.zzaof r3 = r1.zzcct     // Catch:{ all -> 0x014a }
            boolean r3 = r3.isDestroyed()     // Catch:{ all -> 0x014a }
            if (r3 == 0) goto L_0x0148
            com.google.android.gms.internal.zzzl r3 = new com.google.android.gms.internal.zzzl     // Catch:{ all -> 0x014a }
            java.lang.String r4 = "Assets not loaded, web view is destroyed"
            r3.<init>(r4, r5)     // Catch:{ all -> 0x014a }
            throw r3     // Catch:{ all -> 0x014a }
        L_0x0148:
            monitor-exit(r2)     // Catch:{ all -> 0x014a }
            return
        L_0x014a:
            r0 = move-exception
            r3 = r0
            monitor-exit(r2)     // Catch:{ all -> 0x014a }
            throw r3
        L_0x014e:
            r0 = move-exception
            r2 = r0
            com.google.android.gms.internal.zzzl r3 = new com.google.android.gms.internal.zzzl
            java.lang.String r2 = java.lang.String.valueOf(r2)
            r4 = 38
            java.lang.String r6 = java.lang.String.valueOf(r2)
            int r6 = r6.length()
            int r4 = r4 + r6
            java.lang.StringBuilder r6 = new java.lang.StringBuilder
            r6.<init>(r4)
            java.lang.String r4 = "Interrupted while waiting for latch : "
            r6.append(r4)
            r6.append(r2)
            java.lang.String r2 = r6.toString()
            r3.<init>(r2, r5)
            throw r3
        L_0x0176:
            return
        L_0x0177:
            r0 = move-exception
            r3 = r0
            monitor-exit(r2)     // Catch:{ all -> 0x0177 }
            throw r3
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzzs.zze(long):void");
    }

    /* access modifiers changed from: protected */
    public final zzahd zzy(int i) {
        zzacf zzacf = this.zzcob.zzcvm;
        zzkk zzkk = zzacf.zzcrv;
        zzaof zzaof = this.zzcct;
        List<String> list = this.zzcoc.zzchw;
        List<String> list2 = this.zzcoc.zzchx;
        List<String> list3 = this.zzcoc.zzctq;
        int i2 = this.zzcoc.orientation;
        long j = this.zzcoc.zzcic;
        String str = zzacf.zzcry;
        boolean z = this.zzcoc.zzcto;
        zzvp zzvp = this.zzcoo != null ? this.zzcoo.zzcje : null;
        zzwi zzwi = this.zzcoo != null ? this.zzcoo.zzcjf : null;
        return new zzahd(zzkk, zzaof, list, i, list2, list3, i2, j, str, z, zzvp, zzwi, this.zzcoo != null ? this.zzcoo.zzcjg : AdMobAdapter.class.getName(), this.zzcir, this.zzcoo != null ? this.zzcoo.zzcjh : null, this.zzcoc.zzctp, this.zzcob.zzaud, this.zzcoc.zzctn, this.zzcob.zzdcn, this.zzcoc.zzcts, this.zzcoc.zzctt, this.zzcob.zzdch, (zzpx) null, this.zzcoc.zzcuc, this.zzcoc.zzcud, this.zzcoc.zzcue, this.zzcir != null ? this.zzcir.zzcih : false, this.zzcoc.zzcug, this.zzcon != null ? zzk(this.zzcon.zzmf()) : null, this.zzcoc.zzchz, this.zzcoc.zzcuj, this.zzcob.zzdcu, this.zzcoc.zzaqw, this.zzcob.zzdcv);
    }
}
